#pragma once

#include "stdafx.h"

namespace Diagnostic
{
	class Stopwatch
	{
	private:
		clock_t _start;
		clock_t _end;
	public:
		Stopwatch() : _start(0), _end(0) { }
		void Start()
		{
			_start = clock(); //time(0);
		}
		void End()
		{
			_end = clock();
		}
		float GetElapsed()
		{
			return ((float)(_end - _start)) / 1000.f;
		}
		void PrintResolution()
		{
			clock_t t1, t2;
			t1 = t2 = clock();

			// loop until t2 gets a different value
			while(t1 == t2)
				t2 = clock();
			
			std::cout << (double)(t2 - t1) / CLOCKS_PER_SEC * 1000 << " ms.\n";
		}
	};
}